Whether the specified device can be accessed.
bool MV_CC_IsDeviceAccessible( MV_CC_DEVICE_INFO *pstDevInfo, unsigned int nAccessMode );
[IN] Device information, see the structure MV_CC_DEVICE_INFO for details.
[IN] Access type, see the table below for details.
|
Macro Definition |
Value |
Description |
|---|---|---|
|
MV_ACCESS_Exclusive |
1 |
Exclusive permission, for other apps, the CCP register is only allowed to be read |
|
MV_ACCESS_ExclusiveWithSwitch |
2 |
Preempt permission in mode 5, and then open with exclusive permission |
|
MV_ACCESS_Control |
3 |
Control permission, for other apps, all registers are allowed to be read |
|
MV_ACCESS_ControlWithSwitch |
4 |
Preempt permission in mode 5, and then open with control permission |
|
MV_ACCESS_ControlSwitchEnable |
5 |
Open with control permission that can be preempted |
|
MV_ACCESS_ControlSwitchEnableWithKey |
6 |
Preempt permission in mode 5, and then open with control permission that can be preempted |
|
MV_ACCESS_Monitor |
7 |
Open device with reading mode, suitable under control permission |
Return true to indicate the device is accessible, and return false to indicate no permission or the device is offline.
You can read the device CCP register value to check the current access permission.
Return false if the device does not support the modes MV_ACCESS_ExclusiveWithSwitch, MV_ACCESS_ControlWithSwitch, MV_ACCESS_ControlSwitchEnableWithKey. Currently the device does not support the 3 preemption modes, neither do the devices from other mainstream manufacturers.
This API is not supported by CameraLink device.
The following sample code is for reference only.
#include "MvCameraControl.h"
void main()
{
int nRet = -1;
void* m_handle = NULL;
//Enumerate all devices corresponding to specified transport protocol within subnet
unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
if (MV_OK != nRet)
{
printf("error: EnumDevices fail [%x]\n", nRet);
return;
}
int i = 0;
if (m_stDevList.nDeviceNum == 0)
{
printf("no camera found!\n");
return;
}
//Select the first found online device and create device handle
int nDeviceIndex = 0;
MV_CC_DEVICE_INFO m_stDevInfo = {0};
memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));
nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);
if (MV_OK != nRet)
{
printf("error: CreateHandle fail [%x]\n", nRet);
return;
}
//Determine whether specified device is accessible
unsigned int nAccessMode = MV_ACCESS_Exclusive;
nRet = MV_CC_IsDeviceAccessible(&m_stDevInfo, nAccessMode);
if (MV_OK != nRet)
{
printf("error: IsDeviceAccessible fail [%x]\n", nRet);
return;
}
//...other processing
//Destroy handle and release resource
nRet = MV_CC_DestroyHandle(m_handle);
if (MV_OK != nRet)
{
printf("error: DestroyHandle fail [%x]\n", nRet);
return;
}
}
Whether the specified device can be accessed.
bool MV_CC_IsDeviceAccessible( MV_CC_DEVICE_INFO *pstDevInfo, unsigned int nAccessMode );
[IN] Device information, see the structure MV_CC_DEVICE_INFO for details.
[IN] Access type, see the table below for details.
|
Macro Definition |
Value |
Description |
|---|---|---|
|
MV_ACCESS_Exclusive |
1 |
Exclusive permission, for other apps, the CCP register is only allowed to be read |
|
MV_ACCESS_ExclusiveWithSwitch |
2 |
Preempt permission in mode 5, and then open with exclusive permission |
|
MV_ACCESS_Control |
3 |
Control permission, for other apps, all registers are allowed to be read |
|
MV_ACCESS_ControlWithSwitch |
4 |
Preempt permission in mode 5, and then open with control permission |
|
MV_ACCESS_ControlSwitchEnable |
5 |
Open with control permission that can be preempted |
|
MV_ACCESS_ControlSwitchEnableWithKey |
6 |
Preempt permission in mode 5, and then open with control permission that can be preempted |
|
MV_ACCESS_Monitor |
7 |
Open device with reading mode, suitable under control permission |
Return true to indicate the device is accessible, and return false to indicate no permission or the device is offline.
You can read the device CCP register value to check the current access permission.
Return false if the device does not support the modes MV_ACCESS_ExclusiveWithSwitch, MV_ACCESS_ControlWithSwitch, MV_ACCESS_ControlSwitchEnableWithKey. Currently the device does not support the 3 preemption modes, neither do the devices from other mainstream manufacturers.
This API is not supported by CameraLink device.
The following sample code is for reference only.
#include "MvCameraControl.h"
void main()
{
int nRet = -1;
void* m_handle = NULL;
//Enumerate all devices corresponding to specified transport protocol within subnet
unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
if (MV_OK != nRet)
{
printf("error: EnumDevices fail [%x]\n", nRet);
return;
}
int i = 0;
if (m_stDevList.nDeviceNum == 0)
{
printf("no camera found!\n");
return;
}
//Select the first found online device and create device handle
int nDeviceIndex = 0;
MV_CC_DEVICE_INFO m_stDevInfo = {0};
memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));
nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);
if (MV_OK != nRet)
{
printf("error: CreateHandle fail [%x]\n", nRet);
return;
}
//Determine whether specified device is accessible
unsigned int nAccessMode = MV_ACCESS_Exclusive;
nRet = MV_CC_IsDeviceAccessible(&m_stDevInfo, nAccessMode);
if (MV_OK != nRet)
{
printf("error: IsDeviceAccessible fail [%x]\n", nRet);
return;
}
//...other processing
//Destroy handle and release resource
nRet = MV_CC_DestroyHandle(m_handle);
if (MV_OK != nRet)
{
printf("error: DestroyHandle fail [%x]\n", nRet);
return;
}
}